package com.healthshare.parse.icenter;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.healthshare.parse.share.CommentParse.CommentItem;
import com.healthshare.parse.share.ShareListParse.ShareListItem;
import com.palmedia.framework.parse.BaseParse;




/**
 * @author xudeliang
 * 我的私信用户
 */
public class MyChatUserListParse extends BaseParse
{

	/*{
		“chatuserlist ”:[
{"userid":"3232",“nickname”:”昵称”,}，
{"userid":"3232",“nickname”:”昵称”,}]
}


	*/
	
	public ArrayList<ChatUser> chatUserList = new ArrayList<ChatUser>();
	public MyChatUserListParse()
	{
		
	}
	
	
	@Override
	public boolean Parse(byte[]data)
	{
		boolean ret = super.Parse(data);
		if(!ret)
		{
			return false;
		}
		if(JSON==parseType)
		{
			try 
			{
				JSONArray ja = jsonObject.getJSONArray("chatuserlist");
				int len = ja.length();
				for(int i=0;i<len;i++)
				{
					ChatUser kv = new ChatUser();
					JSONObject iobject =ja.getJSONObject(i);
					kv.userid = iobject.getString("userid");
					kv.nickname = iobject.getString("nickname");
					chatUserList.add(kv);
				}
				return true;
			} 
			catch (JSONException e) 
			{
				e.printStackTrace();
			}
		}
		return false;
	}
	public class ChatUser
	{
		public String userid;
		public String nickname;
	}
}
